<?php
switch ($aEvent->type)
{
	case Module::INITIALIZE_MODULE:
		if (!class_exists('Initialisation'))
		{
			$definition =  'class Initialisation
							{
								const INITIALIZE = "<Initialisation>: Initialize";
							}';
							
			eval($definition);
							
			Events::addEventListener(Initialisation::INITIALIZE, "initialisation");
		}
		break;
		
	case Initialisation::INITIALIZE:
		if (Configuration::get("modules") != "")
		{
			$modules = array();
			if (strpos(Configuration::get("modules"), ",") === FALSE)
				$modules = array(Configuration::get("modules"));
			else
				$modules = explode(",", Configuration::get("modules"));
				
			foreach ($modules as $module)
			{
				if (!ModuleController::hasModule($module)) ModuleController::loadModule($module);
			}
		}
		break;
	
	case Module::UNLOAD_MODULE:
		Events::removeEventListener(Initialisation::INITIALIZE, "initialisation");
		break;
	
	default:
		break;
}		
?>